package com.yunxi.controller.otd;

import com.yunxi.core.web.ApiResult;
import com.yunxi.otd.pojo.OtdOrderCirEditVO;
import com.yunxi.otd.pojo.OtdOrderCirScheduleQueryVO;
import com.yunxi.otd.service.OtdOrderCirDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * CIR生产订单 前端控制器
 * </p>
 *
 * @author XUQI
 * @since 2019-07-15
 */
@RestController
@RequestMapping("/admin/otd/cir")
@Api(tags = "OTD:ORDERCIR", description = "CIR生产订单接口")
public class OtdOrderCirController {

    @Autowired
    OtdOrderCirDubboService otdOrderCirDubboService;

    @GetMapping("/page")
    @ApiOperation(value = "CIR日排程查询")
    public ApiResult page(OtdOrderCirScheduleQueryVO queryVO) {
        return otdOrderCirDubboService.findCirSchedule(queryVO);
    }

    @GetMapping("/month/week")
    @ApiOperation(value = "月CIR分周排程查询")
    public ApiResult queryMonthCirWeekly(OtdOrderCirScheduleQueryVO queryVO) {
        return otdOrderCirDubboService.findMonthCirWeekly(queryVO);
    }

    @PostMapping("/edit")
    @ApiOperation(value = "CIR数量编辑")
    public ApiResult edit(@RequestBody OtdOrderCirEditVO editVO) {
        return otdOrderCirDubboService.editOrderNum(editVO);
    }

    @GetMapping("/noEditDays")
    public ApiResult getNoEditDays(String yearMonth) {
        return otdOrderCirDubboService.getNoEditDays(yearMonth);
    }

}
